SetAxisGear
Commands a ratio between the velocity of the slave and master axis.
Syntax
KsCommandStatus SetAxisGear(
int Master,
int Slave,
BOOL Permanent,
double Ratio,
McSource MasterValueSource,
double Acceleration,
double Deceleration,
double Jerk,
McBufferMode BufferMode
);
Parameters
Master [in]: the index of the master axis. Indexes are zero based. Aliases affect this parameter.
Slave [in]: the index of the slave axis. Indexes are zero based. Aliases affect this parameter. The number of slaves is up to 32.
Permanent [in]: determines whether the gear state is preserved after the motor is disabled.
TRUE: the gear state is preserved even if the motor is disabled. For example, if the master axis is enabled, the slave axis will be enabled. If an error has occurred on the master, it occurred on the slave too.
FALSE: the gear state won't be preserved after the motor is disabled.
Ratio [in]: the gear ratio. For example, if the ratio is 3:2, the slave moves three units and master moves two.
MasterValueSource [in]: defines the source for synchronization. See the McSource type.
- mcSetValue – synchronization on master set value. We suggest you use these settings.
- mcActualValue – synchronization on master actual value. This setting may not be stable.
- mcSecondEncoderValue – actual value of the secondary encoder of the axis.
NOTE: mcSecondEncoderValue is not supported yet.
Acceleration [in]: the acceleration for gearing in.
Deceleration [in]: the deceleration for gearing in.
Jerk [in]: the jerk for gearing in.
BufferMode [in]: defines how to blend the velocity of two functions. See the McBufferMode type.
Return value
Returns the KsCommandStatus structure.
Remarks
- The slave ramps up to the ratio of the master velocity and locks in when this is reached. Any lost distance during synchronization is not caught up.
- The gearing ratio can be changed while SetAxisGear is running, using a consecutive SetAxisGear function without the necessity to ReleaseAxis first.
- After being "InSync," a position locking or just a velocity locking is system-specific.
- To detach the slave axis, use ReleaseAxis.
Example
KsCommandStatus AssignGearSlave(INT Master, INT Slave) {
KsCommandStatus gear = WaitForCommand(10, FALSE, SetAxisGear(Master, Slave, FALSE,
2 / 1, //Gear factor
mcSetValue, /*Master Value Source. Value of the master position used.
Cam be the target position (commanded value and set value are identical)
or the actual position.*/
36000,
36000,
3600000,
mcAborting)
);
return gear;
}
Requirements
RT | Win32 | |
---|---|---|
Minimum supported version | 4.0 | 4.0 |
Header | ksmotion.h | ksmotion.h |
Library | KsApi_Rtss.lib | KsApi.lib |
See also